package org.young.common.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.young.common.service.UserService;

/**
 * Created by young on 16/9/28.
 */
@Component("userService")
public class UserServiceImpl implements UserService{

    private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);


    @Autowired
    private AmqpTemplate amqpTemplate;

    @Override
    public String say(String name){
        System.out.println("[UserServiceImpl say] --->>> " + name);
        return "[UserServiceImpl say] --->>> " + name;
    }

    @Override
    public boolean send(String queueKey, Object object){
        LOGGER.info("[UserServiceImpl send ] parameter : message {}",object.toString());

        amqpTemplate.convertAndSend(queueKey,object);

        return true;
    }

}
